package common;

public class Coordinate {
	public Coordinate() {
		set(0, 0);
	}
	
	public Coordinate(int x, int y) {
		set(x, y);
	}
	public Coordinate(float x, float y) {
		set(x, y);
	}

	public int X;
	public int Y;
	public int getX() {
		return (int)X;
	}
	public int getY() {
		return (int)Y;
	}
	public void translate(float x, float y) {
		X += x;
		Y += y;
	}
	
	public void translate(Vector vector) {
		X += vector.X;
		Y += vector.Y;
	}
	
	public void set(float x, float y) {
		X = (int)x;
		Y = (int)y;
	}
	
	public Coordinate copyTo(Coordinate other) {
		if(other == null) {
			return clone();
		}
		other.X = X;
		other.Y = Y;
		return other;
	}
	
	public Coordinate clone() {
		return new Coordinate(X, Y);
	}
	
	@Override
	public String toString() {
		return "[X:" + X  + " Y:" + Y + "]";
	}
}